home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / v10n12.arc / QUARTER.DBF < prev    next >
Text File  |  1991-05-30  |  806b  |  28 lines

  1. * Technique to compute any quarter of year based on input from user.
  2. * Adjust the string of numbers to fit quarter arrangement.  Replace
  3. * QTR or MNTH with your field name. The variable QTR is returned as
  4. * string data.  If a numeric variable is needed use: VAL(qtr)
  5. * or use the system date as in the following:
  6. * qtr = VAL(SUBSTR("111222333444",MONTH(DATE()),1)
  7.  
  8. * dBASE III Plus tested.
  9. SET TALK OFF
  10. CLEAR
  11. mnth = 0
  12. @ 10,10 SAY "Enter month to translate: " GET mnth RANGE 1,12
  13. READ
  14.  
  15. * Here is one-liner number 1
  16. qtr = SUBSTR("111222333444",mnth,1)
  17.  
  18. * Here is one-liner number 2
  19. qtrsufx = SUBSTR("--st-nd-rd-th",VAL(qtr)*3,2)
  20.  
  21. * Here is the results
  22. @ 12,10 SAY "Month "+ LTRIM(STR(mnth))+" is the " + qtr + qtrsufx +;
  23. " quarter."
  24.  
  25. RELEASE mnth, qtr, qtrsufx
  26. SET TALK ON
  27. RETURN
  28.